<%inherit file="/base.mako"/>
% if c.category != '':
${h.link_to('Root', h.url_for(id=None))}
% for item in c.path:
->${h.link_to(item.name, h.url_for(id=item.id))}
% endfor 
<br/>
Имя: ${c.category.name}
<br/>
Родитльская категория: ${h.link_to(c.category.parent_category.name, h.url_for(id=c.category.parent_category.id)) if c.category.parent_category != None else None}
<br/>
Описание: ${c.category.description}
<br/>
% endif
Child Categories
<table cellpadding="0" cellspacing="0" border="1">
<thead>
<th>ID</th><th>Name</th><th>Edit</th><th>Delete</th>
</thead>
<tbody>
% for category in c.child_categories:
<tr>
<td>${category.id}</td>
<td>${h.link_to(category.name, h.url_for('category', id=category.id))}</td>
<td>${h.link_to('Edit', h.url_for(action="edit", id=category.id))}</td>
<td>${h.link_to('Delete', h.url_for(action="delete", id=category.id))}</td>
</tr>
% endfor
</tbody>
</table>
${h.link_to(u'Создать', h.url_for(action="add", parent_category_id=c.category.id if c.category != '' else None))}
<br/>
${h.link_to(u'Редактировать', h.url_for(action="edit")) if c.category != '' else ''}

% if c.category != '':
<h3>Properties</h3>
<table cellpadding="0" cellspacing="0" border="1">
<thead>
<th>Code</th><th>Type</th><th>Remove</th>
</thead>
<tbody>
% for item in c.properties:
<tr>
<td>${item.code}</td>
<td>${c.data_types[item.data_type][0]}</td>
<td>${h.link_to('Remove', h.url_for(action="delete_property", id=c.category.id, property_code=item.code))}</td>
</tr>
% endfor
</tbody>
</table>
${h.form(h.url(action='save_add_property'), method='post')}
Property: ${h.select('property_code',  h.options_for_select_from_objects(c.all_properties, 'code'))}
${h.submit(u'Add Property')}
${h.end_form()}
${h.link_to('Manage Properties', h.url_for(controller='property'), target='blank')}

<h3>Products</h3>
<table cellpadding="0" cellspacing="0" border="1">
<thead>
<th>ID</th><th>Picture</th><th>Name</th><th>Edit</th><th>Delete</th>
</thead>
<tbody>
% for item in c.products:
<tr>
<td>${item.id}</td>
<td>
% if item.main_image != '':
	${h.tag('img', src=h.url_for(controller='image', action='index', id=item.main_image.file_name, image_id=item.main_image.id, width='100', height='100'))}
% endif
</td>
<td>${h.link_to(item.name, h.url_for('product', url_mapping=item.url_mapping))}</td>
<td>${h.link_to('Edit', h.url_for(controller='product', action="edit", id=item.id, category_id=c.category.id))}</td>
<td>${h.link_to('Delete', h.url_for(controller='product', action="delete", id=item.id))}</td>
</tr>
% endfor
</tbody>
</table>

${h.link_to('Add Product', h.url_for(controller='product', action='add', id=None, category_id=c.category.id))}

% endif